<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="con"></div>
<script>
    let con = document.getElementById("con");
    if (window.EventSource) {
        let eventSource = new EventSource("http://localhost:8080/api/sse/createSse?uid=${uid}");
        eventSource.onopen = (event) => {
            console.log("SSE连接成功！");
        };
        eventSource.onmessage = function (event) {
            let data = event.data;
            // console.log("SSE发送数据：" + data);
            con.innerHTML += event.data + "<br/>";
        };
        eventSource.onerror = (error) => {
            console.log("SSE连接失败！");
        };
    } else {
        alert("您的浏览器不支持SSE！");
    }
</script>
</body>
</html>
